package com.yanqu.road.entity.player;

import com.yanqu.road.entity.DataObject;
import com.yanqu.road.entity.DataStatus;
import com.yanqu.road.entity.FieldTypeAnnotation;
import org.apache.mina.util.ConcurrentHashSet;

import java.util.HashSet;
import java.util.Set;

/**
 * 门客皮肤羁绊
 */
@FieldTypeAnnotation(tableName = "t_u_patrons_skin_bond")
public class UserPatronsSkinBond extends DataObject {
    @FieldTypeAnnotation(select = true, update = true)
    long userId;
    @FieldTypeAnnotation(update = true)
    int combId;
    @FieldTypeAnnotation(desc = "光环等级")
    int level;
    @FieldTypeAnnotation(desc = "激活羁绊的皮肤id")
    Set<Integer> bondIdSet = new ConcurrentHashSet<>();

    public long getUserId() {
        return userId;
    }
    public void setUserId(long userId) {
        if (this.userId != userId) {
            this.userId = userId;
            setOp(DataStatus.Update);
        }
    }

    public int getCombId() {
        return combId;
    }
    public void setCombId(int combId) {
        if (this.combId != combId) {
            this.combId = combId;
            setOp(DataStatus.Update);
        }
    }

    public int getLevel() {
        return level;
    }
    public void setLevel(int level) {
        if (this.level != level) {
            this.level = level;
            setOp(DataStatus.Update);
        }
    }

    public Set<Integer> getBondIdSet() {
        return bondIdSet;
    }
    public void setBondIdSet(ConcurrentHashSet<Integer> bondIdSet) {
        if (null == bondIdSet){
            return;
        }
        if (this.bondIdSet == null || !this.bondIdSet.equals(bondIdSet)) {
            this.bondIdSet = bondIdSet;
            setOp(DataStatus.Update);
        }
    }

    public void addBondId(int skinId){
        this.bondIdSet.add(skinId);
        setUpdateOption();
    }
}
